/*  
 * Copyright (C) 2011 Marta Spodymek
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 *  
 */
package org.prometheuscode.web.feedback.domain;

import java.util.Map;

/**
 * 
 * This class represents user feedback on some topic.
 * 
 * 
 * @author marta
 * 
 */
public class Feed implements IFeed {

    private String id;

    private String type;

    private String name;

    private IUser user;

    private Map<String, IFeedInput> userFormInput;

    public Feed() {
    }

    public Feed(String id, String type, String name) {
	this.id = id;
	this.type = type;
	this.name = name;
    }

    @Override
    public String getId() {
	return this.id;
    }

    @Override
    public void setId(String id) {
	this.id = id;
    }

    @Override
    public String getType() {
	return this.type;
    }

    @Override
    public void setType(String type) {
	this.type = type;
    }

    @Override
    public String getName() {

	return this.name;
    }

    @Override
    public void setName(String name) {
	this.name = name;
    }

    @Override
    public Map<String, IFeedInput> getUserFormInput() {
	return this.userFormInput;
    }

    @Override
    public void setUserFormInput(Map<String, IFeedInput> userFormInput) {
	this.userFormInput = userFormInput;
    }

    @Override
    public IUser getUser() {
	return this.user;
    }

    @Override
    public void setUser(IUser user) {
	this.user = user;
    }

    @Override
    public boolean equals(Object obj) {
	if (obj == this) {
	    return true;
	}

	if (obj == null || !(IFeed.class.isAssignableFrom(obj.getClass()))) {
	    return false;
	}

	IFeed feed = (IFeed) obj;

	return (this.id.equals(feed.getId()));
    }

    @Override
    public final int hashCode() {
	return this.id.hashCode();

    }

}
